﻿create PROCEDURE Sync.SP_BoardAttachments_SelectChanges
@LastRowVersion rowversion,
@FilterdColumn UNIQUEIDENTIFIER
AS 
BEGIN 
	SELECT 
        t.[BoardAttachmentID],
		g.[BoardID],g.[Attachment],
		t.IsDeleted,
		t.LastUpdatedDate
	FROM [dbo].[BoardAttachments] g RIGHT JOIN Sync.BoardAttachments_Tracking t  
    ON t.BoardAttachmentID = g.BoardAttachmentID 
    join [Board] b
		on b.BoardID = g.BoardID
	WHERE (@LastRowVersion IS NULL OR t.Version > @LastRowVersion)
	AND ((@FilterdColumn IS NULL) OR (b.CommitteeID = @FilterdColumn))
    END











